<template>
    <div id="root">
        <button @click="getStudentInfo">获取学生信息</button>
         <button @click="getCarInfo">获取汽车信息</button>
    </div>
  
</template>

<script>
    //引入axios
    import axios from 'axios'
    export default {
        name: 'App',
        methods: {
            getStudentInfo() {
                axios.get('http://localhost:8081/api/students')  
                .then(response => {
                     console.log(response.data)
                 })
                .catch(error => {
                     console.log(error)
                 })
            },
            getCarInfo() {
                axios.get('http://localhost:8081/car/cars')  
                .then(response => {
                     console.log(response.data)
                 })
                .catch(error => {
                     console.log(error)
                 })
            }
        }
    }
</script>

<style>
</style>